<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <title>添加班级</title>
</head>
<style>
        .layui-form{
            height: 250px;
           padding-top: 40px;
        }
        .buttonOne{
           width: 50%;
           height: 40px;
           margin-top: 80px;
           padding-left: 40%;
        }
        .buttonOne button{
            margin-left: 10px;
        }
        .layui-input, .layui-textarea{
            width: 70%;
        }
        .layui-form-label{
            padding: 9px 30px;
        }
        .layui-form-select .layui-edge{
          right: 30%;
        }
        .layui-form-select dl{
            min-width: 70%;
            left: 30px;
        }
      
    </style>
<body>
        <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">班级名称</label>
            <div class="layui-input-block">
              <input type="text" name="class_name" required  lay-verify="required" placeholder="请输入班级名称" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
                <label class="layui-form-label">学&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;年</label>
                <div class="layui-input-block">
                  <input type="text" name="educationLen" required  lay-verify="required" placeholder="请输入年份" autocomplete="off" class="layui-input">
                </div>
              </div>
            
          <div class="layui-form-item">
               <label class="layui-form-label">选择院系</label>
               <div class="layui-input-block">
                 <select name="cl_dep_id" lay-verify="required" class="layui-input">
                 <c:forEach items="${departments}" var="departments">
                       <option name="departmentName" value="${departments.dep_id}">${departments.department}</option>
                 </c:forEach>
                 </select>

               </div>
            </div>
           
        <div class="layui-form-item">
            <div class="layui-input-block buttonOne">
                <button class="layui-btn" lay-submit lay-filter="formDemo" >立即提交</button>
                <button type="reset" class="layui-btn layui-btn layui-btn-warm">重置</button>
            </div>
        </div>
    </form>
</body>
 <script>
        $(function  () {
            layui.use('form', function(){
              var form = layui.form; 
            });
            
            $(".layui-btn").click(function(){
            	  var url = "/TeacherEvaluation/addClass_submit";
		       	  var param = $(".layui-form").serialize();//表单序列化传递到后台
		       	  $.post(url, param, function(data) {
		       		if(data.flag==0){
		       			alert(data.msg);
		       			location.href="/TeacherEvaluation/showClass";
		       		}else if(data.flag==1){
		       			alert(data.msg);
		 					location.reload();
		       		}else if(data.flag==2){
		       			alert(data.msg);
		 					location.reload();
		       		} 
		       	  });
            });
            
           
        })
    </script>
</html>